import request from '@/utils/request'
import { renderUrl } from '../../utils'

const headers = {
  'Content-Type': 'application/json'
}

export function add(data) {
  return request({
    url: '/admin/resource/create',
    method: 'post',
    data: JSON.stringify(data),
    headers
  })
}

export function del(data) {
  return request({
    url: renderUrl('/admin/resource/delete/{id}', data),
    method: 'post'
  })
}

export function edit(data) {
  return request({
    url: '/admin/resource/update',
    method: 'post',
    data: JSON.stringify(data),
    headers
  })
}

export default { add, edit, del }

